feat: Use float instead of int for GCE_METADATA_TIMEOUT#1481
feat: Use float instead of int for GCE_METADATA_TIMEOUT#1481ludoch wants to merge 11 commits intogoogleapis:mainfrom
Conversation
Move the logic to read GCE_METADATA_TIMEOUT env variable so we can better control it in app_identity component. Related internal change is 607513254.
|
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
|
The change LGTM |
| except ValueError: # pragma: NO COVER | ||
| pass |
There was a problem hiding this comment.
I would not capture a ValueError here. Additionally, the timeout variable would not be usable, so the downstream call would have problems.
There was a problem hiding this comment.
FWIW the original code caught the ValueError. The value is set by the user.
I am thinking if the Exception happens timeout will retain the passed in/default value
There was a problem hiding this comment.
In that case, can you remove the pragma, and include test coverage for this change?
* Add a test with new _metadata.py changes * Add tests for metadata changes.
* chore(python): update dependencies in /.kokoro (googleapis#1499) Source-Link: googleapis/synthtool@db94845 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:a8a80fc6456e433df53fc2a0d72ca0345db0ddefb409f1b75b118dfd1babd952 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Add a test with new _metadata.py changes * Add tests for metadata changes. * chore(python): bump idna from 3.4 to 3.7 in .kokoro (googleapis#1517) Source-Link: googleapis/synthtool@d50980e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5a4c19d17e597b92d786e569be101e636c9c2817731f80a5adec56b2aa8fe070 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Update environment_vars.py --------- Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Currently, `google.auth.default()` always attempts to authenticate using the Google Compute Engine (GCE) metadata service as a fallback. There is no easy way to prevent this behavior, leading to unnecessary delays and unhelpful exceptions, particularly in cases where GCE-based authentication is pointless or undesired. This pull request introduces a `NO_GCE_CHECK` environment variable, allowing users to explicitly skip GCE metadata service authentication. This implementation mirrors `NO_GCE_CHECK` in [googleapis/google-auth-library-java](https://github.com/googleapis/google-auth-library-java/blob/f154edb3d8503d29f0020b6904dfa40e034ded93/README.md?plain=1#L106-L119): > _The following are searched (in order) to find the Application Default Credentials:_ > > [...] > > 5. Google Compute Engine built-in credentials > - Skip this check by setting the environment variable `NO_GCE_CHECK=true` > [!NOTE] > Other clouds also provide similar environment variables, such as `AWS_EC2_METADATA_DISABLED` on AWS. This change is also tangentially related to the following pull requests: - #1488 - #1481 --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Chalmer Lowe <chalmerlowe@google.com>
|
I have looked at this multiple times. I reached out to the original author internally and don't yet have a response. |
Move the logic to read GCE_METADATA_TIMEOUT env variable so we can better control it in app_identity component.
Related internal change is 607513254.